﻿@page "/soul"

@if (soul == null)
{
    <Loading />
}
else
{
    <div class="soul"><h1>@soul.Result</h1></div>
    <div class="soul"><button class="soul-btn" @onclick="OnInitializedAsync">再来一碗</button></div>
}

@code {
    /// <summary>
    /// 毒鸡汤数据
    /// </summary>
    private ServiceResult<string> soul;

    /// <summary>
    /// 初始化
    /// </summary>
    /// <returns></returns>
    protected override async Task OnInitializedAsync()
    {
        await Common.SetTitleAsync("毒鸡汤");

        soul = null;
        soul = await Http.GetFromJsonAsync<ServiceResult<string>>("/soul");
    }
}